<template>
  <div id="app">
    <!-- 3、以标签的形式使用 -->
    <MyHead></MyHead>
    <button @click="flag = !flag">控制body展示</button>
    <!-- <keep-alive>
      <MyBody v-if="flag"></MyBody>
    </keep-alive> -->
    <MyBody v-if="flag"></MyBody>
    <!-- <img alt="Vue logo" src="./assets/logo.png" /> -->
    <!-- <HelloWorld msg="Welcome to Your Vue.js App"/> -->
  </div>
</template>

<script>
// import HelloWorld from './components/HelloWorld.vue'
// 1、引入组件
import MyHead from "./components/head.vue";
import MyBody from "./components/body.vue";

export default {
  name: "App",
  data() {
    return {
      flag: true,
    };
  },
  components: {
    // 2、注册组件
    // HelloWorld
    MyHead,
    MyBody,
  },
};
</script>

<style>
* {
  padding: 0;
  margin: 0;
  list-style: none;
  box-sizing: border-box;
}
html,
body,
#app {
  width: 100%;
  height: 100%;
}
#app {
  display: flex;
  flex-direction: column;
}
.head {
  width: 100%;
  height: 50px;
  background: #fcc;
  display: flex;
  align-items: center;
  padding: 0 10px;
}
.head input {
  flex: 1;
  height: 30px;
  margin-left: 10px;
}
.body {
  flex: 1;
}
</style>
